package com.ttg.web.controller.common;

import com.ttg.common.entities.BaseResult;
import com.ttg.common.utils.RequestParamsManager;
import com.ttg.model.dto.MemberRattingEditDto;
import com.ttg.model.dto.RattingRulesListAddDto;
import com.ttg.model.dto.RattingRulesListAddInfoDto;
import com.ttg.model.dto.RattingRulesListDto;
import com.ttg.model.dto.open.RattingRulesDeleteDto;
import com.ttg.web.service.VipRattingConfigService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhangHongYuan
 * @description
 * @date 2023/7/5 10:35
 */
@Api("vip评级")
@RestController
@RequestMapping("/vipRating")
public class VipRattingConfigController {
    @Autowired
    private VipRattingConfigService vipGradeRattingService;

    @PostMapping("/ratting/list")
    public BaseResult getRattingList(@RequestBody String data){
        RattingRulesListDto rattingRulesListDto = RequestParamsManager.transformRequestParam(data, RattingRulesListDto.class);
        return BaseResult.success(vipGradeRattingService.getRattingRulesListByRulesId(rattingRulesListDto));
    }
//
//    @PostMapping("/ratting/editList")
//    public BaseResult editRattingList(String data){
//        MemberRattingEditListDto memberRattingEditDto = RequestParamsManager.transformRequestParam(data, MemberRattingEditListDto.class);
//        return memberManagementService.editRattingList(memberRattingEditDto);
//    }
//
    @PostMapping("/ratting/add")
    public BaseResult addRattingList(@RequestBody String data){
        RattingRulesListAddDto rattingRulesListAddDto = RequestParamsManager.transformRequestParam(data, RattingRulesListAddDto.class);
        return BaseResult.success(vipGradeRattingService.addRattingList(rattingRulesListAddDto));
    }
//
    @PostMapping("/ratting/delete")
    public BaseResult deleteRattingList(@RequestBody String data){
        RattingRulesDeleteDto dto = RequestParamsManager.transformRequestParam(data, RattingRulesDeleteDto.class);
        return BaseResult.success(vipGradeRattingService.deleteRattingList(dto));
    }
}
